package com.spic.business.plan.analysis.controller;

import com.spic.business.plan.analysis.dto.PlanAnalysisDTO;
import com.spic.business.plan.analysis.dto.PlanUserDTO;
import com.spic.business.plan.analysis.service.IPlanAnalysisService;
import com.spic.business.plan.analysis.vo.PlanAnalysisVo;
import com.spic.common.core.web.controller.BaseController;
import com.spic.common.core.web.domain.AjaxResult;
import com.spic.common.core.web.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;

/**
 * @author yangjie
 * @date 2021-10-28
 */
@RestController
@RequestMapping("/plan/analysis")
public class PlanAnalysisController extends BaseController
{
    @Autowired
    private IPlanAnalysisService planAnalysisService;

    /**
     * 组织结构数据
     * @return
     */
    @GetMapping("/planuserlist")
    public AjaxResult getPlanUserList(){
        startPage();
        List<PlanUserDTO> list = planAnalysisService.selectPlanUserList();
        return AjaxResult.success(list);
    }

    /**
     * 返回数据中心统计数据
     * @param planAnalysisDTO
     * @return
     */
    @GetMapping("/planlist")
    public AjaxResult planList(PlanAnalysisDTO planAnalysisDTO)
    {
        HashMap<String,Object> list = planAnalysisService.selectPlanList(planAnalysisDTO);
        return AjaxResult.success(list);
    }

    /**
     * 超期未演练子表
     * @param planAnalysisVo
     * @return
     */
    @GetMapping("/emergencyplantablelist")
    public TableDataInfo selectemergencyplantableList(PlanAnalysisVo planAnalysisVo)
    {
        startPage();
        List<PlanAnalysisVo> list = planAnalysisService.selectemergencyplantableList(planAnalysisVo);
        return getDataTable(list);
    }

    /**
     * 待演练子表
     * @param planAnalysisVo
     * @return
     */
    @GetMapping("/todrilltable")
    public TableDataInfo selecttodrilltableList(PlanAnalysisVo planAnalysisVo)
    {
        startPage();
        List<PlanAnalysisVo> list = planAnalysisService.selecttodrilltableList(planAnalysisVo);
        return getDataTable(list);
    }

    /**
     * 预案启动子表
     * @param planAnalysisVo
     * @return
     */
    @GetMapping("/plantostarttable")
    public TableDataInfo selectplantostarttableList(PlanAnalysisVo planAnalysisVo)
    {
        startPage();
        List<PlanAnalysisVo> list = planAnalysisService.selectplantostarttableList(planAnalysisVo);
        return getDataTable(list);
    }

    /**
     * 应急预案子表
     * @param planAnalysisVo
     * @return
     */
    @GetMapping("/contingencyplantable")
    public TableDataInfo selectcontingencyplantableList(PlanAnalysisVo planAnalysisVo)
    {
        startPage();
        List<PlanAnalysisVo> list = planAnalysisService.selectcontingencyplantableList(planAnalysisVo);
        return getDataTable(list);
    }

}
